import {RENQI_JIA, RENQI_JIAN} from '../constants';

//封装创建 action 对象的函数  jiaAction(10)  => {type: 'jia', data: 10}
export let jiaAction = data => {
    return {type: RENQI_JIA, data: data}
}

export let jianAction = data => {
    return {type: RENQI_JIAN, data};
}

//异步封装   封装创建返回函数的函数
export let asyncJiaAction = data => {
    return dispatch => {
        setTimeout(() => {
            //修改状态
            dispatch(jiaAction(data));
        }, 1000);
    }
}